/*
 * Copyright (c) 2025, 2025, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * The Universal Permissive License (UPL), Version 1.0
 *
 * Subject to the condition set forth below, permission is hereby granted to any
 * person obtaining a copy of this software, associated documentation and/or
 * data (collectively the "Software"), free of charge and under any and all
 * copyright rights in the Software, and any and all patent rights owned or
 * freely licensable by each licensor hereunder covering either (i) the
 * unmodified Software as contributed to or provided by such licensor, or (ii)
 * the Larger Works (as defined below), to deal in both
 *
 * (a) the Software, and
 *
 * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
 * one is included with the Software each a "Larger Work" to which the Software
 * is contributed by such licensors),
 *
 * without restriction, including without limitation the rights to copy, create
 * derivative works of, display, perform, and distribute the Software and make,
 * use, sell, offer for sale, import, export, have made, and have sold the
 * Software and the Larger Work(s), and to sublicense the foregoing rights on
 * either these or other terms.
 *
 * This license is subject to the following condition:
 *
 * The above copyright notice and either this complete permission notice or at a
 * minimum a reference to the UPL must be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.oracle.truffle.regex.tregex.test.generated;

import static com.oracle.truffle.regex.tregex.string.Encoding.UTF_32;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.match;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.noMatch;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.syntaxError;
import static com.oracle.truffle.regex.tregex.test.generated.TestCase.testCase;

public class PythonGeneratedTests {

    public static final TestCase[] TESTS = {
        // @formatter:off
        /* GENERATED CODE BEGIN - KEEP THIS MARKER FOR AUTOMATIC UPDATES */

        // Generated using sre from CPython 3.13.5
        // re._casefix._EXTRA_CASES
        testCase("i", "i", UTF_32, match("\u0131", 0, 0, 1, -1)),
        testCase("s", "i", UTF_32, match("\u017f", 0, 0, 1, -1)),
        testCase("\u00b5", "i", UTF_32, match("\u03bc", 0, 0, 1, -1)),
        testCase("\u0131", "i", UTF_32, match("i", 0, 0, 1, -1)),
        testCase("\u017f", "i", UTF_32, match("s", 0, 0, 1, -1)),
        testCase("\u0345", "i", UTF_32, match("\u03b9", 0, 0, 1, -1)),
        testCase("\u0345", "i", UTF_32, match("\u1fbe", 0, 0, 1, -1)),
        testCase("\u0390", "i", UTF_32, match("\u1fd3", 0, 0, 1, -1)),
        testCase("\u03b0", "i", UTF_32, match("\u1fe3", 0, 0, 1, -1)),
        testCase("\u03b2", "i", UTF_32, match("\u03d0", 0, 0, 1, -1)),
        testCase("\u03b5", "i", UTF_32, match("\u03f5", 0, 0, 1, -1)),
        testCase("\u03b8", "i", UTF_32, match("\u03d1", 0, 0, 1, -1)),
        testCase("\u03b9", "i", UTF_32, match("\u0345", 0, 0, 1, -1)),
        testCase("\u03b9", "i", UTF_32, match("\u1fbe", 0, 0, 1, -1)),
        testCase("\u03ba", "i", UTF_32, match("\u03f0", 0, 0, 1, -1)),
        testCase("\u03bc", "i", UTF_32, match("\u00b5", 0, 0, 1, -1)),
        testCase("\u03c0", "i", UTF_32, match("\u03d6", 0, 0, 1, -1)),
        testCase("\u03c1", "i", UTF_32, match("\u03f1", 0, 0, 1, -1)),
        testCase("\u03c2", "i", UTF_32, match("\u03c3", 0, 0, 1, -1)),
        testCase("\u03c3", "i", UTF_32, match("\u03c2", 0, 0, 1, -1)),
        testCase("\u03c6", "i", UTF_32, match("\u03d5", 0, 0, 1, -1)),
        testCase("\u03d0", "i", UTF_32, match("\u03b2", 0, 0, 1, -1)),
        testCase("\u03d1", "i", UTF_32, match("\u03b8", 0, 0, 1, -1)),
        testCase("\u03d5", "i", UTF_32, match("\u03c6", 0, 0, 1, -1)),
        testCase("\u03d6", "i", UTF_32, match("\u03c0", 0, 0, 1, -1)),
        testCase("\u03f0", "i", UTF_32, match("\u03ba", 0, 0, 1, -1)),
        testCase("\u03f1", "i", UTF_32, match("\u03c1", 0, 0, 1, -1)),
        testCase("\u03f5", "i", UTF_32, match("\u03b5", 0, 0, 1, -1)),
        testCase("\u0432", "i", UTF_32, match("\u1c80", 0, 0, 1, -1)),
        testCase("\u0434", "i", UTF_32, match("\u1c81", 0, 0, 1, -1)),
        testCase("\u043e", "i", UTF_32, match("\u1c82", 0, 0, 1, -1)),
        testCase("\u0441", "i", UTF_32, match("\u1c83", 0, 0, 1, -1)),
        testCase("\u0442", "i", UTF_32, match("\u1c84", 0, 0, 1, -1)),
        testCase("\u0442", "i", UTF_32, match("\u1c85", 0, 0, 1, -1)),
        testCase("\u044a", "i", UTF_32, match("\u1c86", 0, 0, 1, -1)),
        testCase("\u0463", "i", UTF_32, match("\u1c87", 0, 0, 1, -1)),
        testCase("\u1c80", "i", UTF_32, match("\u0432", 0, 0, 1, -1)),
        testCase("\u1c81", "i", UTF_32, match("\u0434", 0, 0, 1, -1)),
        testCase("\u1c82", "i", UTF_32, match("\u043e", 0, 0, 1, -1)),
        testCase("\u1c83", "i", UTF_32, match("\u0441", 0, 0, 1, -1)),
        testCase("\u1c84", "i", UTF_32, match("\u0442", 0, 0, 1, -1)),
        testCase("\u1c84", "i", UTF_32, match("\u1c85", 0, 0, 1, -1)),
        testCase("\u1c85", "i", UTF_32, match("\u0442", 0, 0, 1, -1)),
        testCase("\u1c85", "i", UTF_32, match("\u1c84", 0, 0, 1, -1)),
        testCase("\u1c86", "i", UTF_32, match("\u044a", 0, 0, 1, -1)),
        testCase("\u1c87", "i", UTF_32, match("\u0463", 0, 0, 1, -1)),
        testCase("\u1c88", "i", UTF_32, match("\ua64b", 0, 0, 1, -1)),
        testCase("\u1e61", "i", UTF_32, match("\u1e9b", 0, 0, 1, -1)),
        testCase("\u1e9b", "i", UTF_32, match("\u1e61", 0, 0, 1, -1)),
        testCase("\u1fbe", "i", UTF_32, match("\u0345", 0, 0, 1, -1)),
        testCase("\u1fbe", "i", UTF_32, match("\u03b9", 0, 0, 1, -1)),
        testCase("\u1fd3", "i", UTF_32, match("\u0390", 0, 0, 1, -1)),
        testCase("\u1fe3", "i", UTF_32, match("\u03b0", 0, 0, 1, -1)),
        testCase("\ua64b", "i", UTF_32, match("\u1c88", 0, 0, 1, -1)),
        testCase("\ufb05", "i", UTF_32, match("\ufb06", 0, 0, 1, -1)),
        testCase("\ufb06", "i", UTF_32, match("\ufb05", 0, 0, 1, -1)),
        // Syntax errors
        testCase("()\\2", "", UTF_32, syntaxError("invalid group reference 2", 3)),
        testCase("()\\378", "", UTF_32, syntaxError("invalid group reference 37", 3)),
        testCase("()\\777", "", UTF_32, syntaxError("octal escape value \\777 outside of range 0-0o377", 2)),
        testCase("(\\1)", "", UTF_32, syntaxError("cannot refer to an open group", 1)),
        testCase("(?<=()\\1)", "", UTF_32, syntaxError("cannot refer to group defined in the same lookbehind subpattern", 8)),
        testCase("()(?P=1)", "", UTF_32, syntaxError("bad character in group name '1'", 6)),
        testCase("(?P<1)", "", UTF_32, syntaxError("missing >, unterminated name", 4)),
        testCase("(?P<1>)", "", UTF_32, syntaxError("bad character in group name '1'", 4)),
        testCase("(?P<a>)(?P<a>})", "", UTF_32, syntaxError("redefinition of group name 'a' as group 2; was group 1", 11)),
        testCase("[]", "", UTF_32, syntaxError("unterminated character set", 0)),
        testCase("[a-", "", UTF_32, syntaxError("unterminated character set", 0)),
        testCase("[b-a]", "", UTF_32, syntaxError("bad character range b-a", 1)),
        testCase("[\\d-e]", "", UTF_32, syntaxError("bad character range \\d-e", 1)),
        testCase("\\x", "", UTF_32, syntaxError("incomplete escape \\x", 0)),
        testCase("\\x1", "", UTF_32, syntaxError("incomplete escape \\x1", 0)),
        testCase("\\u111", "", UTF_32, syntaxError("incomplete escape \\u111", 0)),
        testCase("\\U1111", "", UTF_32, syntaxError("incomplete escape \\U1111", 0)),
        testCase("\\U1111111", "", UTF_32, syntaxError("incomplete escape \\U1111111", 0)),
        testCase("\\U11111111", "", UTF_32, syntaxError("bad escape \\U11111111", 0)),
        testCase("\\N1", "", UTF_32, syntaxError("missing {", 2)),
        testCase("\\N{1", "", UTF_32, syntaxError("missing }, unterminated name", 3)),
        testCase("\\N{}", "", UTF_32, syntaxError("missing character name", 3)),
        testCase("\\N{a}", "", UTF_32, syntaxError("undefined character name 'a'", 0)),
        testCase("x{2,1}", "", UTF_32, syntaxError("min repeat greater than max repeat", 2)),
        testCase("x**", "", UTF_32, syntaxError("multiple repeat", 2)),
        testCase("^*", "", UTF_32, syntaxError("nothing to repeat", 1)),
        testCase("\\A*", "", UTF_32, syntaxError("nothing to repeat", 2)),
        testCase("\\Z*", "", UTF_32, syntaxError("nothing to repeat", 2)),
        testCase("\\b*", "", UTF_32, syntaxError("nothing to repeat", 2)),
        testCase("\\B*", "", UTF_32, syntaxError("nothing to repeat", 2)),
        testCase("(?", "", UTF_32, syntaxError("unexpected end of pattern", 2)),
        testCase("(?P", "", UTF_32, syntaxError("unexpected end of pattern", 3)),
        testCase("(?P<", "", UTF_32, syntaxError("missing group name", 4)),
        testCase("(?Px", "", UTF_32, syntaxError("unknown extension ?Px", 1)),
        testCase("(?<", "", UTF_32, syntaxError("unexpected end of pattern", 3)),
        testCase("(?x", "", UTF_32, syntaxError("missing -, : or )", 3)),
        testCase("(?P<>)", "", UTF_32, syntaxError("missing group name", 4)),
        testCase("(?P<?>)", "", UTF_32, syntaxError("bad character in group name '?'", 4)),
        testCase("(?P=a)", "", UTF_32, syntaxError("unknown group name 'a'", 4)),
        testCase("(?#", "", UTF_32, syntaxError("missing ), unterminated comment", 0)),
        testCase("(", "", UTF_32, syntaxError("missing ), unterminated subpattern", 0)),
        testCase("(?i", "", UTF_32, syntaxError("missing -, : or )", 3)),
        testCase("(?L", "", UTF_32, syntaxError("bad inline flags: cannot use 'L' flag with a str pattern", 3)),
        testCase("(?t:)", "", UTF_32, syntaxError("unknown extension ?t", 1)),
        testCase("(?-t:)", "", UTF_32, syntaxError("unknown flag", 3)),
        testCase("(?-:)", "", UTF_32, syntaxError("missing flag", 3)),
        testCase("(?ij:)", "", UTF_32, syntaxError("unknown flag", 3)),
        testCase("(?i-i:)", "", UTF_32, syntaxError("bad inline flags: flag turned on and off", 5)),
        testCase(")", "", UTF_32, syntaxError("unbalanced parenthesis", 0)),
        testCase("\\", "", UTF_32, syntaxError("bad escape (end of pattern)", 0)),
        testCase("(?P<a>)(?(0)a|b)", "", UTF_32, syntaxError("bad group number", 10)),
        testCase("()(?(1", "", UTF_32, syntaxError("missing ), unterminated name", 5)),
        testCase("()(?(1)a", "", UTF_32, syntaxError("missing ), unterminated subpattern", 2)),
        testCase("()(?(1)a|b", "", UTF_32, syntaxError("missing ), unterminated subpattern", 2)),
        testCase("()(?(2)a)", "", UTF_32, syntaxError("invalid group reference 2", 5)),
        testCase("(?(a))", "", UTF_32, syntaxError("unknown group name 'a'", 3)),
        testCase("(a)b(?<=(?(2)b|x))(c)", "", UTF_32, syntaxError("cannot refer to an open group", 13)),
        testCase("(?(2147483648)a|b)", "", UTF_32, syntaxError("invalid group reference 2147483648", 3)),
        testCase("(?(42)a|b)[", "", UTF_32, syntaxError("unterminated character set", 10)),
        testCase("(a{2}|())+$", "", UTF_32, match("aaaa", 0, 0, 4, 4, 4, 4, 4, 1)),
        testCase("^a(b*)\\1{4,6}?", "", UTF_32,
            match("abbbb", 0, 0, 1, 1, 1, 1),
            match("abbbbb", 0, 0, 6, 1, 2, 1)),
        testCase("a(?:c|b(?=()))*", "", UTF_32, match("abc", 0, 0, 3, 2, 2, 1)),
        testCase("a(?:c|b(?=(c)))*", "", UTF_32, match("abc", 0, 0, 3, 2, 3, 1)),
        testCase("a(?:c|(?<=(a))b)*", "", UTF_32, match("abc", 0, 0, 3, 0, 1, 1)),
        testCase("((A|){7,10}?){10,17}", "", UTF_32, match("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 86, 86, 86, 86, 86, 1)),
        testCase("(a{1,30}){1,4}", "", UTF_32, match("a", 0, 0, 1, 0, 1, 1)),
        testCase("((a|){4,6}){4,6}", "", UTF_32,
            match("a", 0, 0, 1, 1, 1, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2, 2, 2, 1),
            match("aaa", 0, 0, 3, 3, 3, 3, 3, 1),
            match("aaaa", 0, 0, 4, 4, 4, 4, 4, 1),
            match("aaaaa", 0, 0, 5, 5, 5, 5, 5, 1),
            match("aaaaaa", 0, 0, 6, 6, 6, 6, 6, 1),
            match("aaaaaaa", 0, 0, 7, 7, 7, 7, 7, 1),
            match("aaaaaaaa", 0, 0, 8, 8, 8, 8, 8, 1),
            match("aaaaaaaaa", 0, 0, 9, 9, 9, 9, 9, 1),
            match("aaaaaaaaaa", 0, 0, 10, 10, 10, 10, 10, 1),
            match("aaaaaaaaaaa", 0, 0, 11, 11, 11, 11, 11, 1),
            match("aaaaaaaaaaaa", 0, 0, 12, 12, 12, 12, 12, 1),
            match("aaaaaaaaaaaaa", 0, 0, 13, 13, 13, 13, 13, 1)),
        testCase("((a?){4,6}){4,6}", "", UTF_32,
            match("aaaaaaa", 0, 0, 7, 7, 7, 7, 7, 1),
            match("aaaaaa", 0, 0, 6, 6, 6, 6, 6, 1)),
        testCase("((|a){4,6}){4,6}", "", UTF_32,
            match("a", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1),
            match("aaaaaaaaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1)),
        testCase("((a??){4,6}){4,6}", "", UTF_32, match("aaaaaaa", 0, 0, 0, 0, 0, 0, 0, 1)),
        testCase("(a|^){100}", "", UTF_32,
            match("a", 0, 0, 1, 0, 1, 1),
            match("aa", 0, 0, 2, 1, 2, 1),
            noMatch("aa", 1),
            noMatch("ab", 1)),
        testCase("(a|){4,6}", "", UTF_32,
            match("a", 0, 0, 1, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2, 1),
            match("aaa", 0, 0, 3, 3, 3, 1),
            match("aaaa", 0, 0, 4, 4, 4, 1),
            match("aaaaa", 0, 0, 5, 5, 5, 1),
            match("aaaaaa", 0, 0, 6, 5, 6, 1),
            match("aaaaaaa", 0, 0, 6, 5, 6, 1)),
        testCase("(a|){4,6}?", "", UTF_32,
            match("a", 0, 0, 1, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2, 1),
            match("aaa", 0, 0, 3, 3, 3, 1),
            match("aaaa", 0, 0, 4, 3, 4, 1),
            match("aaaaa", 0, 0, 4, 3, 4, 1),
            match("aaaaaa", 0, 0, 4, 3, 4, 1),
            match("aaaaaaa", 0, 0, 4, 3, 4, 1)),
        testCase("(a|){4,6}?a", "", UTF_32,
            match("a", 0, 0, 1, 0, 0, 1),
            match("aa", 0, 0, 2, 1, 1, 1),
            match("aaa", 0, 0, 3, 2, 2, 1),
            match("aaaa", 0, 0, 4, 3, 3, 1),
            match("aaaaa", 0, 0, 5, 3, 4, 1),
            match("aaaaaa", 0, 0, 5, 3, 4, 1),
            match("aaaaaaa", 0, 0, 5, 3, 4, 1),
            match("aaaaaaaa", 0, 0, 5, 3, 4, 1)),
        testCase("(|a){4,6}a", "", UTF_32,
            match("a", 0, 0, 1, 0, 0, 1),
            match("aa", 0, 0, 1, 0, 0, 1),
            match("aaa", 0, 0, 1, 0, 0, 1),
            match("aaaa", 0, 0, 1, 0, 0, 1),
            match("aaaaa", 0, 0, 1, 0, 0, 1),
            match("aaaaaa", 0, 0, 1, 0, 0, 1),
            match("aaaaaaa", 0, 0, 1, 0, 0, 1)),
        testCase("((a|){4,6}?){4,6}", "", UTF_32,
            match("a", 0, 0, 1, 1, 1, 1, 1, 1),
            match("aa", 0, 0, 2, 2, 2, 2, 2, 1),
            match("aaa", 0, 0, 3, 3, 3, 3, 3, 1),
            match("aaaa", 0, 0, 4, 4, 4, 4, 4, 1),
            match("aaaaa", 0, 0, 5, 5, 5, 5, 5, 1),
            match("aaaaaa", 0, 0, 6, 6, 6, 6, 6, 1),
            match("aaaaaaaa", 0, 0, 8, 8, 8, 8, 8, 1),
            match("aaaaaaaaa", 0, 0, 9, 9, 9, 9, 9, 1),
            match("aaaaaaaaaa", 0, 0, 10, 10, 10, 10, 10, 1),
            match("aaaaaaaaaaa", 0, 0, 11, 11, 11, 11, 11, 1),
            match("aaaaaaaaaaaa", 0, 0, 12, 12, 12, 12, 12, 1),
            match("aaaaaaaaaaaaa", 0, 0, 13, 13, 13, 13, 13, 1),
            match("aaaaaaaaaaaaaa", 0, 0, 14, 14, 14, 14, 14, 1),
            match("aaaaaaaaaaaaaaa", 0, 0, 15, 15, 15, 15, 15, 1),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 16, 16, 16, 16, 1),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 17, 17, 17, 17, 17, 1),
            match("aaaaaaaaaaaaaaaaaa", 0, 0, 18, 18, 18, 18, 18, 1)),
        testCase("((a){4,6}?){4,6}", "", UTF_32,
            noMatch("a", 0),
            noMatch("aa", 0),
            noMatch("aaa", 0),
            noMatch("aaaa", 0),
            noMatch("aaaaa", 0),
            noMatch("aaaaaa", 0),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16, 1),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16, 1),
            match("aaaaaaaaaaaaaaaaaaaa", 0, 0, 20, 16, 20, 19, 20, 1),
            match("aaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 20, 24, 23, 24, 1),
            match("aaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 20, 24, 23, 24, 1)),
        testCase("((a){4,6}){4,6}", "", UTF_32,
            noMatch("a", 0),
            noMatch("aa", 0),
            noMatch("aaa", 0),
            noMatch("aaaa", 0),
            noMatch("aaaaa", 0),
            noMatch("aaaaaa", 0),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16, 1),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 17, 13, 17, 16, 17, 1),
            match("aaaaaaaaaaaaaaaaaaaa", 0, 0, 20, 16, 20, 19, 20, 1),
            match("aaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 18, 24, 23, 24, 1),
            match("aaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 18, 24, 23, 24, 1)),
        testCase("((a){4,}){4,6}", "", UTF_32,
            noMatch("a", 0),
            noMatch("aa", 0),
            noMatch("aaa", 0),
            noMatch("aaaa", 0),
            noMatch("aaaaa", 0),
            noMatch("aaaaaa", 0),
            match("aaaaaaaaaaaaaaaa", 0, 0, 16, 12, 16, 15, 16, 1),
            match("aaaaaaaaaaaaaaaaa", 0, 0, 17, 13, 17, 16, 17, 1),
            match("aaaaaaaaaaaaaaaaaaaa", 0, 0, 20, 16, 20, 19, 20, 1),
            match("aaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 24, 20, 24, 23, 24, 1),
            match("aaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 25, 21, 25, 24, 25, 1)),
        testCase("(.)\\1{2,}", "", UTF_32, noMatch("billiam", 0)),
        testCase("(^_(a{1,2}[:])*a{1,2}[:]a{1,2}([.]a{1,4})?_)+", "", UTF_32, match("_a:a:a.aaa_", 0, 0, 11, 0, 11, 1, 3, 6, 10, 1)),
        testCase("(?<=|$)", "", UTF_32, match("a", 0, 0, 0, -1)),
        testCase("(?=ab)a", "", UTF_32, match("ab", 0, 0, 1, -1)),
        testCase("(?=()|^)|x", "", UTF_32, match("empty", 0, 0, 0, 0, 0, 1)),
        testCase("a(?<=ba)", "", UTF_32, match("ba", 0, 1, 2, -1)),
        testCase("(?<=(?<=a)[])", "i", UTF_32, syntaxError("unterminated character set", 10)),
        testCase("(?<=(?=|()))", "", UTF_32, match("aa", 0, 0, 0, -1, -1, -1)),
        testCase("\\d\\W", "i", UTF_32, noMatch("4\u017f", 0)),
        testCase("[\u08bc-\ucf3a]", "i", UTF_32, match("\u03b0", 0, 0, 1, -1)),
        testCase("[\u0450-\u6c50]\u7e57\u55ad()\u64e7\\d|", "i", UTF_32, match("\u03b0\u7e57\u55ad\u64e79", 0, 0, 5, 3, 3, 1)),
        testCase("a(?:|()\\1){1,2}", "", UTF_32, match("a", 0, 0, 1, -1, -1, -1)),
        testCase("[a-z][a-z\u2028\u2029].|ab(?<=[a-z]w.)", "", UTF_32, match("aac", 0, 0, 3, -1)),
        testCase("(animation|animation-name)", "", UTF_32, match("animation", 0, 0, 9, 0, 9, 1)),
        testCase("(a|){7,7}b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("(a|){7,7}?b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("(|a){7,7}b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("(|a){7,7}?b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("(a||b){7,7}c", "", UTF_32,
            match("aaabc", 0, 0, 5, 3, 4, 1),
            match("aaac", 0, 0, 4, 3, 3, 1),
            match("aaabac", 0, 0, 6, 4, 5, 1)),
        testCase("($|a){7,7}", "", UTF_32, match("aaa", 0, 0, 3, 3, 3, 1)),
        testCase("($|a){7,7}?", "", UTF_32, match("aaa", 0, 0, 3, 3, 3, 1)),
        testCase("(a|$){7,7}", "", UTF_32, match("aaa", 0, 0, 3, 3, 3, 1)),
        testCase("(a|$){7,7}?", "", UTF_32, match("aaa", 0, 0, 3, 3, 3, 1)),
        testCase("(a|$|b){7,7}", "", UTF_32,
            match("aaab", 0, 0, 4, 4, 4, 1),
            match("aaa", 0, 0, 3, 3, 3, 1),
            match("aaaba", 0, 0, 5, 5, 5, 1)),
        testCase("((?=a)|a){7,7}b", "", UTF_32, noMatch("aaa", 0)),
        testCase("((?=[ab])|a){7,7}b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("((?<=a)|a){7,7}b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("a((?<=a)|a){7,7}b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("(a|){0,7}b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("(a|){0,7}?b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("(|a){0,7}b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("(|a){0,7}?b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("(a||b){0,7}c", "", UTF_32,
            match("aaabc", 0, 0, 5, 4, 4, 1),
            match("aaac", 0, 0, 4, 3, 3, 1),
            match("aaabac", 0, 0, 6, 5, 5, 1)),
        testCase("((?=a)|a){0,7}b", "", UTF_32, match("aaab", 0, 0, 4, 2, 3, 1)),
        testCase("((?=[ab])|a){0,7}b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("((?<=a)|a){0,7}b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("a((?<=a)|a){0,7}b", "", UTF_32, match("aaab", 0, 0, 4, 3, 3, 1)),
        testCase("(a*?){11,11}?b", "", UTF_32, match("aaaaaaaaaaaaaaaaaaaaaaaaab", 0, 0, 26, 0, 25, 1)),
        testCase("\\w(?<=\\W([l-w]{0,19}?){1,2}\\w)\\2\ua2d2\\1\\z", "", UTF_32, syntaxError("invalid group reference 2", 31)),
        testCase("(?:a(b{0,19})c)", "", UTF_32, match("abbbbbbbcdebbbbbbbf", 0, 0, 9, 1, 8, 1)),
        testCase("(?:a(b{0,19})c)de", "", UTF_32, match("abbbbbbbcdebbbbbbbf", 0, 0, 11, 1, 8, 1)),
        testCase("[\ud0d9](?<=\\S)", "", UTF_32, match("\ud0d9", 0, 0, 1, -1)),
        testCase("[\ud0d9](?<=\\W)", "", UTF_32, noMatch("\ud0d9", 0)),
        testCase("\u0895(?<=\\S)", "", UTF_32, match("\u0895", 0, 0, 1, -1)),
        testCase("\u0895(?<=\\W)", "", UTF_32, match("\u0895", 0, 0, 1, -1)),
        testCase("[\u8053](?<=\\S)", "", UTF_32, match("\u8053", 0, 0, 1, -1)),
        testCase("[\u8053](?<=\\W)", "", UTF_32, noMatch("\u8053", 0)),
        testCase("\u0895|[\u8053\ud0d9]+(?<=\\S\\W\\S)", "", UTF_32, noMatch("\ud0d9\ud0d9\ud0d9\ud0d9", 0)),
        testCase("a|[bc]+(?<=[abc][abcd][abc])", "", UTF_32, match("bbbb", 0, 0, 4, -1)),
        testCase("a(b*)*c\\1d", "", UTF_32, match("abbbbcbbd", 0, 0, 9, 3, 5, 1)),
        testCase("(|a)||b(?<=cde)|", "", UTF_32, match("a", 0, 0, 0, 0, 0, 1)),
        testCase("^(\\1)?\\D*", "", UTF_32, syntaxError("cannot refer to an open group", 2)),
        testCase("\\Dw\u3aa7\\A\\S(?<=\ue3b3|\\A()\\S)", "", UTF_32, noMatch("\udad1\udcfaw\u3aa7A\ue3b3", 0)),
        testCase("(a||b){15,18}c", "", UTF_32, match("ababaabbaaac", 0, 0, 12, 10, 11, 1)),
        testCase("(a||b){15,18}?c", "", UTF_32, match("ababaabbaaac", 0, 0, 12, 10, 11, 1)),
        testCase("(?:ab|c|^){103,104}", "", UTF_32, match("abcababccabccabababccabcababcccccabcababababccccabcabcabccabcabcccabababccabababcababababccababccabcababcabcabccabababccccabcab", 0, 0, 127, -1)),
        testCase("((?<=a)bec)*d", "", UTF_32, match("abecd", 0, 1, 5, 1, 4, 1)),
        testCase("(|(^|\\z){2,77}?)?", "", UTF_32, syntaxError("bad escape \\z", 5)),
        testCase("a(|a{15,36}){10,11}", "", UTF_32, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 1, 1, 1, 1)),
        testCase("a(|a{15,36}?){10,11}", "", UTF_32, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 1, 1, 1, 1)),
        testCase("a(|a{15,36}){10,11}$", "", UTF_32, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 0, 0, 66, 37, 66, 1)),
        testCase("a(|a{15,36}?){10,11}b$", "", UTF_32, match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab", 0, 0, 67, 30, 66, 1)),
        testCase("(?:a()|b??){22,26}c", "", UTF_32, match("aabbbaabaaaaaabaaaac", 0, 0, 20, 19, 19, 1)),
        testCase("b()(a\\1|){4,4}\\2c", "", UTF_32, match("baaaac", 0, 0, 6, 1, 1, 3, 4, 2)),
        testCase("a((?=b()|)[a-d])+", "", UTF_32, match("abbbcbd", 0, 0, 7, 6, 7, 6, 6, 1)),
        testCase("a(|b){5,7}c", "", UTF_32, match("abbbc", 0, 0, 5, 3, 4, 1)),
        testCase("a(|b){5,8}c", "", UTF_32, match("abbbc", 0, 0, 5, 3, 4, 1)),
        testCase("a(|b){5,9}c", "", UTF_32, match("abbbc", 0, 0, 5, 4, 4, 1)),
        testCase("a(|b){5,}c", "", UTF_32, match("abbbc", 0, 0, 5, 4, 4, 1)),
        testCase("a((?<=a)|b){5,7}c", "", UTF_32, match("abbbc", 0, 0, 5, 3, 4, 1)),
        testCase("a((?<=a)|b){5,8}c", "", UTF_32, match("abbbc", 0, 0, 5, 3, 4, 1)),
        testCase("a((?<=a)|b){5,9}c", "", UTF_32, match("abbbc", 0, 0, 5, 3, 4, 1)),
        testCase("a((?<=a)|b){5,}c", "", UTF_32, match("abbbc", 0, 0, 5, 3, 4, 1)),
        testCase("[ab]*?\\Z(?<=[^b][ab][^b])", "", UTF_32, match("aaaaaa", 0, 0, 6, -1)),
        testCase("(?<=a(b){3,3}?)", "", UTF_32, match("abbb", 0, 4, 4, 3, 4, 1)),
        testCase("$(?<=\\Z$)", "", UTF_32, match("\n", 0, 1, 1, -1)),
        testCase("(?<=(?=)*)", "", UTF_32, match("empty", 0, 0, 0, -1)),
        testCase("()(?<=\\1+?)", "", UTF_32, match("empty", 0, 0, 0, 0, 0, 1)),
        testCase("(a){5,36}?(?<=\\1)", "", UTF_32, match("aaaaaaaaaa", 0, 0, 5, 4, 5, 1)),
        testCase("(a)$(\\s)", "", UTF_32, match("a\n", 0, 0, 2, 0, 1, 1, 2, 2)),
        testCase("\\W", "i", UTF_32, noMatch("\u0399", 0)),
        testCase("[\\W]", "i", UTF_32, noMatch("\u0399", 0)),
        testCase("(\\Aa)+?|(?<=ab\\1)", "", UTF_32, noMatch("empty", 0)),
        testCase("^([c-l])\\1|(\\A\\1)+", "", UTF_32, match("kk", 0, 0, 2, 0, 1, -1, -1, 1)),
        testCase("(?:\\Z|\\Aa){1,44}a", "", UTF_32, match("aaaa", 0, 0, 2, -1)),
        testCase("a(\\S*\\s?){8,10}$", "", UTF_32, match("bbabbb b b b bbb bb   bbabbb bbbb", 1, 2, 33, 29, 33, 1)),

        /* GENERATED CODE END - KEEP THIS MARKER FOR AUTOMATIC UPDATES */
        // @formatter:on
    };
}
